#!/usr/bin/python

# Get the instance by its field value

from pyodm.document import Document
from pyodm.fields import *
from pyodm.criteria import Criteria
import sys

class TestDocument(Document):
    field1 = StringField()
    field2 = IntegerField()

crit = Criteria("field2", "=", 16)
objs = TestDocument.get([crit])
obj = objs[0]
print obj.getKey()
print obj.field1
print obj.field2
